<?php
my_component_load('testing' , false);
my_component_load('paging' , false);  
my_component_load('kontrak' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;

$modulname = "Penempatan _BN_ Rekruitment _BN_ Kontrak";
 
if($_SERVER['REQUEST_METHOD'] == "POST" ):
	switch($task){
		case   "edit_page" :
			$validate = form_kontrak_validate($id);
			if($validate){
				$content = message_multi_error($validate );
				$content .= form_kontrak_create($id);
			}else{
				form_kontrak_submit($id);
				generate_my_web('Updated', $pagename ,"plain.php");
				exit;	
			}	
			break;
	}

else:
	if($task == "edit"){ 
		$pagename = ($id > 0 ) ? "Perubahan Data" : "Tambah Data";
		facebox_page('index.php?com=kontrak&task=edit_page&id='.$id , $pagename , 380	);
	}elseif($task == "edit_page"){
		$pagename = ($id > 0 ) ? "Perubahan Data" : "Tambah Data";
		$content = form_kontrak_create($id);
		generate_my_web($content, $pagename ,"plain.php");
		exit;
	}elseif($task == 'delete'){ 
		delete_kontrak($id);
		my_direct('index.php?com=kontrak');
	}else{
		$pagename = $modulname ; 
		load_facebox_script();
		$view =  list_kontrak(); 
	}
endif; 
generate_my_web($view, $pagename );
?>